package com.ys.fmms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ys.fmms.mapper.EnvironmentalNoiseMapper;
import com.ys.fmms.pojo.EnvironmentalNoise;
import com.ys.fmms.service.EnvironmentalNoiseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service(value = "environmentalNoiseServiceImpl")
public class EnvironmentalNoiseServiceImpl extends ServiceImpl<EnvironmentalNoiseMapper, EnvironmentalNoise> implements EnvironmentalNoiseService {
    @Override
    public EnvironmentalNoise getLast() {
        QueryWrapper<EnvironmentalNoise> wrapper = new QueryWrapper<>();
        wrapper.orderByDesc("create_time");
        wrapper.last("limit 1");
        return baseMapper.selectOne(wrapper);
    }
}
